package com.eascs.web.o2o.report.quartz;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.eascs.app.log.Logger;
import com.eascs.app.log.LoggerFactory;
import com.eascs.web.o2o.report.service.ProcessMonitorReportService;
import com.eascs.web.o2o.quartz.util.BaseJobUtil;
import com.eascs.web.o2o.quartz.util.ExecutorService;
import com.eascs.web.o2o.report.service.DayReprotDataService;
import com.eascs.web.o2o.report.service.SynoInfoReportService;

@Component("DayReportQuartz")
public class DayReportQuartz extends BaseJobUtil {
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	@Autowired
	DayReprotDataService dayService;
	@Autowired
	ProcessMonitorReportService processMonitorReportService;
	@Autowired
	SynoInfoReportService synoInfoService;

	public void job_day1() {
		executor("DayReportQuartz", "job_day1", "管理层日报表 （数据来源：service）,6点15分,生成管理层日报表 任务", new ExecutorService() {
			@Override
			public void exe() {
				dayService.adapter_day_service();
			}
		});
	}

	public void job_sendMail1() {
		executor("DayReportQuartz", "job_sendMail1", "8点30分,发送管理层日报表邮件,任务", new ExecutorService() {
			@Override
			public void exe() {
				if (synoInfoService.query()) {
					dayService.job_sendMail_service();
				} else {
					dayService.sendMail_our_service();
				}
			}
		});
	}

	public void processMonitorReport() {
		executor("DayReportQuartz", "processMonitorReport", "管理层日报二期-省区流程监控表", new ExecutorService() {
			@Override
			public void exe() {
				processMonitorReportService.processMonitorReport();
			}
		});
	}

	/*public void processMonitorendEmial() {
		executor("DayReportQuartz", "processMonitorendEmial", "管理层日报二期-省区流程监控表发送", new ExecutorService() {
			@Override
			public void exe() {
				processMonitorReportService.process_sendMail();
			}
		});
	}*/

	public void asset_structure_report() {
		executor("DayReportQuartz", "asset_structure_report",
				"新日邮件（资产结构本金日报和合作银行放款台账-新模板）（数据来源：service）,6点25分,生成资产结构本金日报任务", new ExecutorService() {
					@Override
					public void exe() {
						dayService.ass_adapter_day_service();
						dayService.rerundBankReportByNew();
					}
				});
	}

	public void asset_structure_sendMail() {
		executor("DayReportQuartz", "asset_structure_report", "8点40分,发送发送新日邮件（资产结构本金日报和合作银行放款台账-新模板）邮件,任务",
				new ExecutorService() {
					@Override
					public void exe() {
						if (synoInfoService.query()) {
							dayService.asset_sendMail_service();
						} else {
							dayService.asset_sendMail_our_service();
						}
					}
				});
	}
}
